package neu.soft.feign;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import neu.soft.vo.ResultBean;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.Map;

@Component
@Slf4j
public class UserFeignClientFallBackFactory implements FallbackFactory<UserFeignClient> {
    @Override
    public UserFeignClient create(Throwable throwable) {
        return new UserFeignClient() {
            @Override
            public ResultBean changeOrderStatus(@RequestBody Map<String, Object> map){
                log.info(throwable.getMessage());
                return ResultBean.error(500,throwable.getMessage());
            }
        };
    }
}
